# http://www.renren.com/SysHome.do
import requests
from lxml import etree
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36'
}
# url_login = 'http://www.renren.com/SysHome.do'
#登陆界面获取
login_text = requests.get(url=url_login,headers=headers).text
tree = etree.HTML(login_text)
#获取验证码url，将验证码保存至本地识别
img_url = tree.xpath('//*[@id="verifyPic_login"]/@src')[0]
img = requests.get(url=img_url,headers=headers).content
with open('./code.jpg','wb') as f:
    f.write(img)

#检测验证码
# def img_cheak(code.jpg)
#     pass
#     return code
#模拟登录
